using System;
using System.IO;
using System.Text;

namespace newtelligence.DasBlog.Util.Html
{
	/// <summary>
	/// Summary description for ContentFormatter.
	/// </summary>
	public class ContentFormatter
	{
        public static string FormatContentAsHTML(string content)
        {
            HtmlFormatter formatter = new HtmlFormatter();
            StringWriter writer = new StringWriter();
            HtmlFormatterOptions options = new HtmlFormatterOptions(' ',3,80,HtmlFormatterCase.LowerCase,HtmlFormatterCase.LowerCase,false);
            formatter.Format( content, writer, options );
            return writer.GetStringBuilder().ToString();
        }

        public static string FormatContentAsXHTML(string content)
        {
            // first format
            HtmlFormatter formatter = new HtmlFormatter();
            StringWriter writer = new StringWriter();
            HtmlFormatterOptions options = new HtmlFormatterOptions(' ',3,80,true);
            string contentRoot = "<body xmlns=\"http://www.w3.org/1999/xhtml\">"+content+"</body>";
            formatter.Format( contentRoot, writer, options );
            return writer.GetStringBuilder().ToString();
        }
	}
}
